﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class TrangChu : System.Web.UI.Page
{
    private string PQ;
    private string MaSPPQ;
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["GioHang"] != null)
        {
            Label lblSL = (Label)this.Master.FindControl("lblSL");
            lblSL.Text = Session["TongSL"].ToString();
            Label lblTT = (Label)this.Master.FindControl("lblTongTien");
            lblTT.Text = Session["TongTien"].ToString();
        }
        for (int i = 0; i < DataList1.Controls.Count; i++)
        {
            if (Session["ADMIN"] != null)
            {
                DataList1.Controls[i].FindControl("SuaAn").Visible = true;
                DataList1.Controls[i].FindControl("XoaAn").Visible = true;


            }
            else
            {
                DataList1.Controls[i].FindControl("SuaAn").Visible = false;
                DataList1.Controls[i].FindControl("XoaAn").Visible = false;
            }       
        }
        try
        {
            if (Session["Xoa"] == null)
            {
                PQ = Request.QueryString.Get("q");
                MaSPPQ = Request.QueryString.Get("MaSP");
                if (PQ.ToString() == "1")
                {
                    SanphamDTO xoa = new SanphamDTO();
                    xoa.MaSP1 = MaSPPQ.ToString();
                    SanPhamBUS.Hasp(xoa);
                    Session["Xoa"] = PQ.ToString();
                    Response.Redirect("~/TrangChu.Aspx");

                }
            }
            else
            {
                Session["Xoa"] = null;
                messagebox.Show("Đã Xóa Sản Phẩm");
            }
           
        }
        catch (Exception ex)
        {

        }
    }
    protected void CMGui_Click(object sender, EventArgs e)
    {

    }
   
}